package com.heima.model.admin.pojos;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.Alias;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("ad_user")
public class AdUser {

    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;

    @TableField("name")
    private String name;

    @TableField("password")
    private String password;

    @TableField("salt")
    private String salt;

    //昵称
    @TableField("nickname")
    private String nickName;

    @TableField("image")
    private String image;

    @TableField("phone")
    private String phone;

    //状态:0暂时不可用,1永久不可用,9正常可用
    @TableField("status")
    private Short status;

    @TableField("email")
    private String email;

    //最后一次登录时间
    @TableField("login_time")
    private Date loginTime;

    @TableField("created_time")
    private Date createdTime;

    //状态枚举
    @Alias("AdUserStatus")
    public enum Status{
        NOT_USE_NOW((short)0),NOT_USE_FOREVER((short) 1),USE((short) 9);
        Short code;
        Status(short code){
            this.code = code;
        }
        public Short getCode(){
            return this.code;
        }
    }
}
